home *** CD-ROM | disk | FTP | other *** search
- class classes.shots.BomberABomb
- {
- var x;
- var y;
- var id;
- var dir;
- var clip;
- var xMov;
- var yMov;
- var cMax;
- var xDiv;
- var yDiv;
- var c = 0;
- var power = 50;
- var yank = false;
- var Name = "bomberABomb";
- function BomberABomb(px, py, pxMov, pdir, pid)
- {
- this.x = px;
- this.y = py;
- this.id = pid;
- this.dir = pdir;
- _root.d = _root.d + 1;
- this.clip = _root.attachMovie("bomberABomb","bomberABomb" + this.id + "Clip",_root.d + 3600);
- this.clip._x = this.x;
- this.clip._y = this.y;
- this.xMov = pxMov;
- this.yMov = this.dir != "U" ? 6 : -6;
- this.cMax = _root.randRange(30,60);
- this.xDiv = _root.randRange2(0.99,0.97);
- this.yDiv = _root.randRange2(0.99,0.97);
- }
- function hit()
- {
- this.explo();
- this.yank = true;
- }
- function bombed()
- {
- this.explo();
- this.yank = true;
- }
- function explo()
- {
- _root.createExploB([this.x + this.clip._width / 2,this.y + this.clip._height / 2,_root.randRange(90,120),100,"B"]);
- var _loc3_ = 0;
- var _loc4_ = random(2) + 3;
- while(_loc3_ < _loc4_)
- {
- _root.createExploB([this.x + this.clip._width / 2 + _root.randRange(-25,25),this.y + this.clip._height / 2 + _root.randRange(-25,25),_root.randRange(40,75),_root.randRange(25,60),"B"]);
- _loc3_ = _loc3_ + 1;
- }
- }
- function main()
- {
- this.c = this.c + 1;
- this.xMov *= this.xDiv;
- this.yMov *= this.yDiv;
- if(this.c >= this.cMax)
- {
- this.explo();
- this.yank = true;
- }
- if(this.clip.hitTest(_root[_root.char + "Clip"]))
- {
- this.explo();
- _root[_root.char].hit(this.xMov,this.yMov,100,this.power);
- this.yank = true;
- }
- var _loc4_ = 0;
- var _loc6_ = _root.broShots.length;
- while(_loc4_ < _loc6_)
- {
- var _loc5_ = _root.broShots[_loc4_] + "Clip";
- if(this.clip.hitTest(_root[_loc5_]))
- {
- this.explo();
- this.yank = true;
- _root[_root.char].fc = _root[_root.char].fireFreq - _root.rapidVar;
- var _loc3_ = _root.broShots[_loc4_];
- _root[_loc3_].exploX = this.x + this.clip._width / 2;
- _root[_loc3_].exploY = this.y + this.clip._height / 2;
- _root[_loc3_].hit(20);
- }
- _loc4_ = _loc4_ + 1;
- }
- this.x += this.xMov;
- this.y += this.yMov;
- this.clip._x = this.x;
- this.clip._y = this.y;
- if(this.yank)
- {
- _root.audio.playLevel4("bomberBombX" + (random(3) + 1),_root.randRange(13,22));
- _root.removeEnemyShot("bomberABomb" + this.id);
- this.yank = false;
- }
- }
- }
-